<template>
  <footer class="footer">
    <span class="todo-count">
      剩余<strong>{{ $store.getters.rlist.length }}</strong>
    </span>
    <ul class="filters">
      <li>
        <a
          :class="{ selected: status === 'all' }"
          href="javascript:;"
          @click="$store.commit('footer/all')"
          >全部</a
        >
      </li>
      <li>
        <a
          :class="{ selected: status === 'no' }"
          href="javascript:;"
          @click="$store.commit('footer/no')"
          >未完成</a
        >
      </li>
      <li>
        <a
          :class="{ selected: status === 'yes' }"
          href="javascript:;"
          @click="$store.commit('footer/yes')"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="$store.commit('main/clearList')">
      清除已完成
    </button>
  </footer>
</template>

<script>
export default {
  computed: {
    status() {
      return this.$store.state.footer.status
    }
  }
}
</script>